import React, { useRef } from "react";

function UseFd(callback: any, delay: number) {
  const timerRef = useRef < any > null;

  const Fd = () => {
    if (timerRef.current) {
      clearTimeout(timerRef.current);
    }
    timerRef.current = setTimeout(() => {
      callback();
    }, delay);
  };
  return Fd;
}

export default UseFd;
